<form action="" method="post" enctype="multipart/form-data" name="form2" id="form2" class="validate">
    <div class="ermsg"  id="ermsg"><?php echo $errorMsg; ?></div>
    <table width="100%" border="0" cellspacing="2" cellpadding="2">
        <tr>
            <td width="34%">Component Name </td>
            <td width="36%">
                <input name="component_name" type="text" id="title" class="reqd" />
            </td>
            <td width="24%">&nbsp;</td>
            <td width="6%">&nbsp;</td>
        </tr>
        <tr>
            <td>Component Description </td>
            <td><label>
                    <textarea name="component_desc" id="pcontent"></textarea>
                </label></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>Component Category </td>
            <td>

                <select name="component_cat" style="float:left" onchange="checkCat(this.value)">
                    <?php  $rs_s = getCategoryByParent(20);
                    $row_cat = mysql_fetch_assoc($rs_s);
                    do { ?>
                    <option value="<?php echo $row_cat["category_id"]; ?>"><?php echo $row_cat["category_name"]; ?></option>
                        <?php }while( $row_cat = mysql_fetch_assoc($rs_s));?>
                    <option value="0" >Not In List</option>
                </select>
                <div class="none" style="float:left;background: #f0f0f0" id="comp_id">
		Please Enter a Category
                    <input name="cat_name" type="text" id="cat_name"  />
                </div>	  </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>Upload Component </td>
            <td><label>
                    <input name="component_file" type="file" id="component_file" />
                </label></td>
            <td colspan="2">Please upload a zip file or the single file for the component </td>
        </tr>
        <tr>
            <td>Component Start Page </td>
            <td><label>
                    <input name="start_page" type="text" id="start_page" />
                    <input name="isadd" type="hidden" id="isadd" value="no" />
                    <input name="frmaction" type="hidden" id="componentadd" value="componentadd" />
                </label></td>
            <td colspan="2">Enter the start page for the component eg setup.php </td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>        <input type="submit" name="Submit" value="Upload Component" />      </td>
            <td colspan="2">&nbsp;</td>
        </tr>
    </table>
</form>
<script type="text/javascript">
    function checkCat(catid){
        if(catid=="0"){
            document.getElementById("comp_id").style.display="inline";
            document.getElementById("is_add").value="yes";
        } else{
            document.getElementById("comp_id").style.display="none";
            document.getElementById("comp_id").value="";
            document.getElementById("is_add").value="no";
        }}
</script>